Using the Central Accordion Tab Component
Table of Contents
Adding Favorite Tab Support
If you have viewed many Central applications, you have probably noticed that a few of them have favorite tabs that allow users to store their favorite items for the application. Each favorite tab contains an icon that visually indicates it’s the tab's function.
The application also contains a button icon with the favorites icon. When the user selects the button, the favorites icon moves to the tab to tell the user visually that the item has been added to the user’s favorites.
You can achieve this functionality by combining the MAccordionTab and MIconButton components. This section explains show how to add this animation to your application.
You can use the file created in the setDataProvider section
as the basis for this example.
First, you need to make the icon appear on the tab. This is done by
specifying the icon property in the data provider for the favorites
tab. Note that this will not work when populating the component using
the addItem or addItemAt methods. You must
populate it using the setDataProvider method.
Here is the code necessary to add the icon to a tab:
function onActivate()
{
var dp = new Central.DataProviderClass();
dp.addItem({label:"Tab 1"});
dp.addItem({label:"Tab 2", icon:"MAccordionTabFavoritesFlag"});
dp.addItem({label:"Tab 3"});
myTab.setDataProvider(dp);
}
Central.initApplication(this, this);
Notice you add a property called icon with the value of “MAccordionFavoritesFlag”
to the second item:
dp.addItem({label:"Tab 2", icon:"MAccordionTabFavoritesFlag"});
This places a favorites icon on the second tab, labeled “Tab 2”.
Next, you need to place the button onto the Stage that contains the favorites icon.
- Create a new layer above the accordion’s layer and name it “icon button”.
- Drag an instance of the MIconButton component from the Central section of the components panel to the new layer.
- With the component selected, set the Built in Icon property in the property inspector to “icon_bookmark_add”.
That is all that is necessary. Publish the application, and view it within in Central (see Figure 8).

Figure 8. Accordion Tab and IconButton with favorites icons
The tab and icon button controls should be visible. If you click the icon button, the favorites icon will move from the button to the tab.
There is also an animation for removing an item from favorites. To view it, switch back to Flash, and change the icon for the IconButton component to “icon_button_remove”. Publish and test your application within Central.
Now, when you click the button, the favorites icon in the tab animates to indicate that the item was removed.
The code that actually copies the data from one section to another is beyond the scope of this article.
Additional Resources
- Macromedia Central SDK - Contains the Accordion Tab component as well as complete documentation for it.
- Accordion Tab LiveDocs Documentation
- Macromedia Central Development Quick Start Guide
- Macromedia Central Developer Center
- Macromedia Central Web forums